import request from './request'


export function login(params) {
    return request({
        url: 'api/token/',
        method: 'post',
        data: params
    })
}

export function getRouter() {
    return request({
        url: 'menu/router/',
        method: 'get'
    })
}

export function getArea(params) {
    return request({
        url: 'area/',
        method: 'get',
        params: params
    })
}

export function getDept(params) {
    return request({
        url: 'dept/',
        method: 'get',
        params: params
    })
}

export function getDeptLazy(params) {
    return request({
        url: 'dept/lazy/',
        method: 'get',
        params: params
    })
}

export function getDeptOptions(params) {
    return request({
        url: 'dept/options/',
        method: 'get',
        params: params
    })
}

export function getSchools() {
    return request({
        url: 'dept/schools/',
        method: 'get',
    })
}

export function getHospitals() {
    return request({
        url: 'dept/hospitals/',
        method: 'get',
    })
}

export function createDept(data) {
    return request({
        url: 'dept/',
        method: 'post',
        data: data
    })
}

export function updateDept(data) {
    return request({
        url: `dept/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteDept(id) {
    return request({
        url: `dept/${id}/`,
        method: 'delete'
    })
}


export function getPost(params = null) {
    return request({
        url: 'post/',
        method: 'get',
        params: params
    })
}

export function createPost(data) {
    return request({
        url: 'post/',
        method: 'post',
        data: data
    })
}

export function updatePost(data) {
    return request({
        url: `post/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deletePost(id) {
    return request({
        url: `post/${id}/`,
        method: 'delete'
    })
}

export function getRole(params) {
    return request({
        url: 'role/',
        method: 'get',
        params: params
    })
}

export function createRole(data) {
    return request({
        url: 'role/',
        method: 'post',
        data: data
    })
}

export function updateRole(data) {
    return request({
        url: `role/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteRole(id) {
    return request({
        url: `role/${id}/`,
        method: 'delete'
    })
}

export function getUserInfo() {
    return request({
        url: 'user/info/',
        method: 'get'
    })
}

export function getUser(id) {
    return request({
        url: `user/${id}/`,
        method: 'get'
    })
}

export function getUserList(params) {
    return request({
        url: 'user/',
        method: 'get',
        params: params
    })
}

export function setPassword(data) {
    return request({
        url: `user/${data.id}/setpwd/`,
        method: 'post',
        data: data
    })
}

export function getDoctor(params) {
    return request({
        url: `user/doctor/`,
        method: 'get',
        params: params
    })
}

export function getPatient(params) {
    return request({
        url: 'patient/',
        method: 'get',
        params: params
    })
}

export function getPatientById(id) {
    return request({
        url: `patient/${id}/`,
        method: 'get'
    })
}

export function getPatientAll(params) {
    return request({
        url: 'patient/all/',
        method: 'get',
        params: params
    })
}

export function createPatient(data) {
    return request({
        url: 'patient/',
        method: 'post',
        data: data
    })
}

export function updatePatient(data) {
    return request({
        url: `patient/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deletePatient(id) {
    return request({
        url: `patient/${id}/`,
        method: 'delete'
    })
}

export function getReport(params) {
    return request({
        url: 'report/',
        method: 'get',
        params: params
    })
}

export function getReportById(id) {
    return request({
        url: `report/${id}/`,
        method: 'get'
    })
}

export function createReport(data) {
    return request({
        url: 'report/',
        method: 'post',
        data: data
    })
}

export function updateReport(data) {
    return request({
        url: `report/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteReport(id) {
    return request({
        url: `report/${id}/`,
        method: 'delete'
    })
}

export function getBatch(params) {
    return request({
        url: 'batch/',
        method: 'get',
        params: params
    })
}

export function getBatchById(id) {
    return request({
        url: `batch/${id}/`,
        method: 'get'
    })
}

export function getBatchAll(params) {
    return request({
        url: 'batch/all/',
        method: 'get',
        params: params
    })
}

export function createBatch(data) {
    return request({
        url: 'batch/',
        method: 'post',
        data: data
    })
}

export function updateBatch(data) {
    return request({
        url: `batch/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteBatch(id) {
    return request({
        url: `batch/${id}/`,
        method: 'delete',
    })
}

export function getLoginLog(params = null) {
    return request({
        url: 'loginlog/',
        method: 'get',
        params: params
    })
}

export function getOperationLog(params = null) {
    return request({
        url: 'operationlog/',
        method: 'get',
        params: params
    })
}

export function getRoleOptions() {
    return request({
        url: 'role/options/',
        method: 'get'
    })
}

export function getPostOptions() {
    return request({
        url: 'post/options/',
        method: 'get'
    })
}


export function getMenuLazy(params) {
    return request({
        url: 'menu/lazy/',
        method: 'get',
        params: params
    })
}

export function getPermissionList(params) {
    return request({
        url: 'menu/permissions/',
        method: 'get',
        params: params
    })
}

export function getMenuOptions(params) {
    return request({
        url: 'menu/options/',
        method: 'get',
        params: params
    })
}

export function createMenu(data) {
    return request({
        url: 'menu/',
        method: 'post',
        data: data
    })
}

export function updateMenu(data) {
    return request({
        url: `menu/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteMenu(id) {
    return request({
        url: `menu/${id}/`,
        method: 'delete',
    })
}

export function getMenuButton(params) {
    return request({
        url: 'menu_button/',
        method: 'get',
        params: params
    })
}

export function createMenuButton(data) {
    return request({
        url: 'menu_button/',
        method: 'post',
        data: data
    })
}

export function updateMenuButton(data) {
    return request({
        url: `menu_button/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteMenuButton(id) {
    return request({
        url: `menu_button/${id}/`,
        method: 'delete',
    })
}

export function getApiList() {
    return request({
        url: 'swagger.json',
        method: 'get',
    })
}

export function createUser(data) {
    return request({
        url: 'user/',
        method: 'post',
        data: data
    })
}

export function updateUser(data) {
    return request({
        url: `user/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteUser(id) {
    return request({
        url: `user/${id}/`,
        method: 'delete'
    })
}

export function getDictionary(params) {
    return request({
        url: 'dictionary/',
        method: 'get',
        params: params
    })
}

export function createDictionary(data) {
    return request({
        url: 'dictionary/',
        method: 'post',
        data: data
    })
}

export function updateDictionary(data) {
    return request({
        url: `dictionary/${data.id}/`,
        method: 'put',
        data: data
    })
}

export function deleteDictionary(id) {
    return request({
        url: `dictionary/${id}/`,
        method: 'delete',
    })
}

export function getAnalysis(params) {
    return request({
        url: 'analysis/',
        method: 'get',
        params: params
    })
}

export function getHome(params) {
    return request({
        url: 'dashboard/',
        method: 'get',
        params: params
    })
}

export function getReportMangeData(params) {
    return request({
        url: 'reportdata/',
        method: 'get',
        params: params
    })
}